﻿
@using Treca.Business.Base_SysManage;
@using Treca.Quartz.Entity;
@using Treca.Util;
@using EFCore.Sharding;
@inherits DependencyViewPage 
@using System.Data;
@using Microsoft.AspNetCore.Http;
@{
    //Layout = "~/Views/Shared/_Layout_List.cshtml";
    Layout = "~/Views/Shared/_Layout_NewList.cshtml";
    PermissionManage PermissionManage = new PermissionManage();

    var obj = (base_schedulesinfo)Model;
    var objStr = Html.Raw(obj.ToJson());

    <!--hhs 2019-12-27 begin-->
    //按钮权限
    var manageSysPermission = PermissionManage.OperatorHasPermissionValue("base_schedulesinfo.manageSysPermission"); //权限权限分配
    var canManage = PermissionManage.OperatorHasPermissionValue("base_schedulesinfo.manage");//管理
    var canadd = PermissionManage.OperatorHasPermissionValue("base_schedulesinfo.add");//添加
    var canOCRinput = PermissionManage.OperatorHasPermissionValue("base_schedulesinfo.OCRinput");//ocr识别
    var canprint = PermissionManage.OperatorHasPermissionValue("base_schedulesinfo.print");//打印
    var candelete = PermissionManage.OperatorHasPermissionValue("base_schedulesinfo.delete");//删除
    var canmodify = PermissionManage.OperatorHasPermissionValue("base_schedulesinfo.modify");//修改
    var canapprove = PermissionManage.OperatorHasPermissionValue("base_schedulesinfo.approve");//审核
    var canReverse = PermissionManage.OperatorHasPermissionValue("base_schedulesinfo.Reverse");//反审核      
    
    //字段级权限
    var candata = PermissionManage.OperatorHasPermissionValue("base_schedulesinfo.data");//数据权限
    var canprice = PermissionManage.OperatorHasPermissionValue("base_schedulesinfo.price");//价格权限
    
    //记录级权限,有记录级权限，初始化表格GetDataList返回全部数据，没有记录级权限只返回用户自己建立的数据/或者部门建立的数据
    var canRecord = PermissionManage.OperatorHasPermissionValue("base_schedulesinfo.Record");//记录级权限
    var canDepartment = PermissionManage.OperatorHasPermissionValue("base_schedulesinfo.deptRecord");//部门记录级权限
    <!--hhs 2019-12-27 end-->
}

   
<div class="fx-content">
    <div id="toobar">
        <div class="btn-group btn-group-sm">
            <form class="form-inline" id="searchForm">
                <div class="form-group">
                    @if (canManage)
                    {
                        <button onclick="openForm('', '@TranslateService.GetTranslate("", "System_Add", "添加")'); " type="button" class="btn btn-success" aria-label="Left Align">
                            <span class="iconfont icon-ysic_add" aria-hidden="true"></span>
                            @TranslateService.GetTranslate("", "System_Add", "添加")
                        </button>
                    }
                    @if (candelete)
                    {
                        <button onclick="deleteData();" type="button" class="btn btn-danger" aria-label="Right Align">
                            <span class="iconfont icon-ysic_delete" aria-hidden="true"></span>
                            @TranslateService.GetTranslate("", "System_Delete", "删除")
                        </button>

                    }
                    <button type="button" class="btn btn-refresh" aria-label="Right Align" onclick="javascript: location.reload();">
                        <span class="iconfont icon-ysic_refresh" aria-hidden="true"></span>
                        @TranslateService.GetTranslate("", "System_Flash", "刷新")
                    </button>

                    <button type="button" class="btn btn-normal" onclick="upload()">
                        <i class="iconfont icon-ysic_import"></i>
                        @TranslateService.GetTranslate("", "System_Import", "导入数据")
                    </button>
                    <input type="file" id="file" name="myfile" style="display: none" />


                    <button type="button" class="btn btn-normal" onclick="down()">
                        <i class="iconfont icon-ysic_export"></i>
                        @TranslateService.GetTranslate("", "System_Export", "导入数据")
                    </button>

                    <button type="button" class="btn btn-normal" onclick="print()">
                        <i class="iconfont icon-ysic_print"></i>
                        @TranslateService.GetTranslate("", "System_PrintData", "打印数据")
                    </button>
                    <button type="button" class="btn btn-normal" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
                        <i class="iconfont icon-ysic_searchSel"></i>
                        @TranslateService.GetTranslate("", "System_SearchPanel", "搜索条件")
                    </button>
                </div>
            </form>
        </div>
    </div>
 </div>
<div class="fx-wrapper">
    <div class="panel panel-info" id="SearchPanel">
        <div class="panel-heading" role="tab" id="headingThree" style="display: none;">
            <h4 class="panel-title">
                <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
                    @TranslateService.GetTranslate("", "System_SearchPanel", "搜索条件")
                </a>
            </h4>
        </div>
        <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
            <div class="panel-body">
                <div id="builder"></div>
                <script>
                    var searchurl = "/Quartz/base_schedulesinfo/GetDataListByComplexQuery";
                    var searchmode = "ComplexQuery";
                    var rules_basic = {
                    };
                    $.postJSON('/Quartz/base_schedulesinfo/ComplexQueryFilters', {}, function (resJson) {
                        loading(false);
                        if (resJson.Success) {
                            $('#builder').queryBuilder({
                                plugins: {
                                    'bt-selectpicker': { liveSearch: true },//引用了selectpicker
                                    'bt-tooltip-errors': { delay: 100 },
                                },
                                //operators: ['equal', 'greater', 'less', 'greater_or_equal', 'less_or_equal', 'not_equal', 'contains', 'not_contains', 'in', 'not_in',
                                //    'is_empty', 'is_null', 'is_not_empty', 'is_not_null'],
                                operators: [
                                    { type: 'contains', apply_to: ['string', 'number', 'datetime', 'boolean'] },
                                    { type: 'equal', apply_to: ['string', 'number', 'datetime', 'boolean'] },
                                    { type: 'greater', apply_to: ['string', 'number', 'datetime', 'boolean'] },
                                    { type: 'less', apply_to: ['string', 'number', 'datetime', 'boolean'] },
                                    { type: 'greater_or_equal', apply_to: ['string', 'number', 'datetime', 'boolean'] },
                                    { type: 'less_or_equal', apply_to: ['string', 'number', 'datetime', 'boolean'] },
                                    { type: 'not_equal', apply_to: ['string', 'number', 'datetime', 'boolean'] },
                                    { type: 'not_contains', apply_to: ['string', 'number', 'datetime', 'boolean'] },
                                    { type: 'in', apply_to: ['string', 'number', 'datetime', 'boolean'] },
                                    { type: 'not_in', apply_to: ['string', 'number', 'datetime', 'boolean'] },
                                    { type: 'is_empty', apply_to: ['string', 'number', 'datetime', 'boolean'] },
                                    { type: 'is_null', apply_to: ['string', 'number', 'datetime', 'boolean'] },
                                    { type: 'is_not_empty', apply_to: ['string', 'number', 'datetime', 'boolean'] },
                                    { type: 'is_not_null', apply_to: ['string', 'number', 'datetime', 'boolean'] },
                                    { type: 'between' },
                                    { type: 'not_between' },
                                ],
                                filters: resJson.Data,
                                //rules: rules_basic,
                                lang_code: 'zh-CN',
                                 icons: {
                                    add_group: 'iconfont icon-ysic_add',
                                    add_rule: 'iconfont icon-ysic_add',
                                    remove_group: 'iconfont icon-ysic_delete',
                                    remove_rule: 'iconfont icon-ysic_delete'
                                }
                            });
                            // 添加搜索按钮
                                    var searchBtn = $('<button style="margin-right:50px"><i class="iconfont icon-ysic_search"></i>@TranslateService.GetTranslate("", "System_Search", "查询")</button>');
                                        searchBtn.attr("type", "button");
                                        searchBtn.addClass("btn btn-primary");
                                        searchBtn.attr("onclick", "javascript: $('#dataTable').bootstrapTable('refresh', { silent: true,pageNumber:1 });");
                                    $("#builder .rules-group-header").append(searchBtn);
                        }
                        else {
                            searchurl = "/Quartz/base_schedulesinfo/GetDataListBySearchInfo";
                            searchmode = "SearchInfo";
                            $('#SearchInfo').removeClass("hidden");
                            $('#SearchPanel').addClass("hidden");
                            $('#dataTable').bootstrapTable('refresh', { url: searchurl });
                        }
                    });
                </script>
            </div>
        </div>
    </div>

</div>
    <div class="fx-wrapper">
        <table id="dataTable" class="table-bordered"></table>
    </div>
<style type="text/css">
    .fixed-table-header {
        border-right: solid 1px #ddd;
        border-top: solid 1px #ddd;
    }

        .fixed-table-header table {
            border-top: solid 0px #ddd !important;
            margin-top: -1px;
        }
</style>
<script>
    var $table = $('#dataTable');
    var manageSysPermission=@manageSysPermission.ToString().ToLower();
    var canManage =@canManage.ToString().ToLower();
    var canadd = @canadd.ToString().ToLower();//添加
    var candelete = @candelete.ToString().ToLower();//删除
    var canmodify = @canmodify.ToString().ToLower();//修改
    var canapprove = @canapprove.ToString().ToLower();//审核
    var canReverse = @canReverse.ToString().ToLower();//反审核
    var canprint = @canprint.ToString().ToLower();//反审核

    var theEntity = @objStr;

    $(function () {
        initTable();
        bindEvent();
    });

    function showMaxImage(element) {
        showimage($(element)[0].src);
    }

    function showimage(source) {
        var json = {
            "title": "图片列表", //相册标题
            "id": 123, //相册id
            "start": 0, //初始显示的图片序号，默认0
            "data": [   //相册包含的图片，数组格式
                {
                    "alt": "图片列表",
                    "pid": 666, //图片id
                    "src": source, //原图地址
                    "thumb": source //缩略图地址
                }
            ]
        };
        //调用示例
        layer.photos({
            photos: json
        });
    }
    /**
    * 初始化表格高度
    */
    function initTableHeight(){
            //拿到父窗口的centerTabs高度(这是iframe子页面拿到父窗口元素的方法，需要根据自己项目所使用的框架自行修改元素的id)
            var panelH = $("#content-wrapper", parent.document).height();
            //计算表格container该设置的高度
            var height = panelH - 130;
            return height
    }
    //初始化表格
    function initTable() {
        $table.bootstrapTable({
            url: '/Quartz/base_schedulesinfo/GetDataListByComplexQuery',
            idField: 'Id',
            method: 'post',
            contentType: 'application/json',
            queryParamsType: '',
            clickToSelect: false,
            pagination: true,
            sidePagination: "server",
            pageNumber: 1,
            pageSize: 30,
            height:initTableHeight(),
            pageList: [10, 30, 60, 100],
            showRefresh: true,
            showColumns: true,
            showToggle: true,
            onDblClickRow:function (row,$element,field) {
                if(field!='_')
                openForm(row['Id'],'@TranslateService.GetTranslate("","System_ViewData","查看数据")',true);
            },
            columns: [
                { title: 'ck', field: 'ck', checkbox: true, width: '3%' },
                {
                    title: '操作', field: '_', width: '80%', formatter: function (value, row) {
                        var builder = new BtnBuilder();
                        //暂停
                        if (canmodify) {
                            builder.AddBtn({ name: '@TranslateService.GetTranslate("","System_RunJob","运行任务")', icon: 'glyphicon-run', type: 'success', function: 'RunJob', param: [row['JobGroup'], row['JobName']] });
                        }
                        //暂停
                        if (canmodify) {
                            builder.AddBtn({ name: '@TranslateService.GetTranslate("","System_PauseJob","暂停任务")', icon: 'glyphicon-stop', type: 'warning', function: 'PauseJob', param: [row['JobGroup'], row['JobName']] });
                        }
                        //暂停
                        if (canmodify) {
                            builder.AddBtn({ name: '@TranslateService.GetTranslate("", "System_ResumeJob", "恢复任务")', icon: 'glyphicon-resume', type: 'primary', function: 'ResumeJob', param: [row['JobGroup'], row['JobName']] });
                        }
                        return builder.build();
                    }
                },
                    { title: '@TranslateService.GetTranslate("","Quartz_base_schedulesinfo_JobClass","任务类")', field: 'JobClass', width: '5%' },
                    { title: '@TranslateService.GetTranslate("","Quartz_base_schedulesinfo_JobGroup","任务组")', field: 'JobGroup', width: '5%' },
                    { title: '@TranslateService.GetTranslate("","Quartz_base_schedulesinfo_JobName","任务名")', field: 'JobName', width: '5%' },
                    { title: '@TranslateService.GetTranslate("","Quartz_base_schedulesinfo_JobDesc","任务描述")', field: 'JobDesc', width: '5%' },
                    { title: '@TranslateService.GetTranslate("","Quartz_base_schedulesinfo_RunStatus","运行状态")', field: 'RunStatus', width: '5%' },
                    { title: '@TranslateService.GetTranslate("","Quartz_base_schedulesinfo_CromExpress","Cron表达式")', field: 'CromExpress', width: '5%' },
                    { title: '@TranslateService.GetTranslate("","Quartz_base_schedulesinfo_StarRunTime","开始运行时间")', field: 'StarRunTime', width: '5%' },
                    { title: '@TranslateService.GetTranslate("","Quartz_base_schedulesinfo_EndRunTime","结束运行时间")', field: 'EndRunTime', width: '5%' },
                    { title: '@TranslateService.GetTranslate("","Quartz_base_schedulesinfo_PreviousRunTime","上次运行时间")', field: 'PreviousRunTime', width: '5%' },
                    { title: '@TranslateService.GetTranslate("","Quartz_base_schedulesinfo_NextRunTime","下次运行时间")', field: 'NextRunTime', width: '5%' },
                    { title: '@TranslateService.GetTranslate("","Quartz_base_schedulesinfo_Remark","备注")', field: 'Remark', width: '5%' }
            ],onPreBody: function (data) {
                for(var i=0,l=data.length;i<l;i++){
                    for(var key in data[i]){
                        if (data[i][key + "__Name"] != null) {
                            data[i][key] = data[i][key + "__Name"];
                        }
                    }
                }
            },
            queryParams: function (params) {
                if (searchmode == "ComplexQuery") {
                    try {
                        var result = $('#builder').queryBuilder('getRules');
                        return { pagination: params, ComplexQuerys: result };
                    } catch (e) {
                        return { pagination: params };
                    }
                } else {
                    var condition = $("#condition").val();
                    var keyword = $("#keyword").val();
                    var searchParams = [];
                    if (condition != '' && condition != null && keyword != '' && keyword != null) {
                        var searchinfo = new SearchInfo();
                        searchinfo.FiledName = condition;
                        searchinfo.Value = keyword;
                        searchParams.push(searchinfo);
                    }
                    var values = $('#searchForm').getValues();
                    for (var item in values) {
                        if (item == 'condition' || item == 'keyword' || values[item] == '' || values[item] == null) continue;
                        var Operate = $('#searchForm').find('#' + item).attr('Operate');
                        if (Operate == null) Operate = '包含';
                        var searchinfo = new SearchInfo();
                        searchinfo.FiledName = item;
                        searchinfo.Value = values[item];
                        searchinfo.Operate = Operate;
                        searchParams.push(searchinfo);
                    }
                    return { pagination: params, searchInfos: searchParams };
                }
            }
        });
    }
    <!--hhs 2019-12-26 begin-->
    function UpladFile(fileObj) {
        loading();
        var form = new FormData(); // FormData 对象
        form.append("file", fileObj); // 文件对象
        $.ajax({
                url: '/Quartz/base_schedulesinfo/ExportData',     //url地址
            type: 'POST',                 //上传方式
            data: form,                   // 上传formdata封装的数据
            dataType: 'JSON',
            cache: false,                  // 不缓存
            processData: false,        // jQuery不要去处理发送的数据
            contentType: false,         // jQuery不要去设置Content-Type请求头
            success: function(data) {          //成功回调
                //$table.bootstrapTable('refresh');
                //console.log(data);
                  loading(false);
                  if (data.Success) {
                    $table.bootstrapTable('refresh');
                        dialogSuccess('@TranslateService.GetTranslate("","System_Import","导入")@TranslateService.GetTranslate("","System_Success","成功")!');
                    }
                    else {
                        dialogError(data.Msg);
                    }
                       },
            error: function(data) {           //失败回调
                        loading(false);
                        dialogError(data.Msg);
                    }
            });
   }

    function upload() {
        $("#file").click();

    }
    <!--hhs 2019-12-26 end-->
    //绑定事件
    function bindEvent() {
        $('#file').change(function (e) {
            var fileName = e.target.files[0];//js 获取文件对象
            if (fileName !== undefined) {
                var file_typename = fileName.name.substring(fileName.name.lastIndexOf('.'));
                if (file_typename === '.xlsx' || file_typename === '.xls') {
                    $('#file').val('');
                    UpladFile(fileName);
                } else {
                    $('#file').val('');
                    console.log('@TranslateService.GetTranslate("","System_SelectErrorFile","请选择正确的文件类型！")')
                }
            } else {
                $('#file').val('');
                console.log('@TranslateService.GetTranslate("","System_SelectErrorFile","请选择正确的文件类型！")')
            }
        });
    }
     function down() {
         var condition = $("#condition").val();
         var keyword = $("#keyword").val();
         var searchParams = [];
         if (condition != '' && condition != null && keyword != '' && keyword!=null) {
             var searchinfo = new SearchInfo();
             searchinfo.FiledName = condition;
             searchinfo.Value = keyword;
             searchParams.push(searchinfo);
         }
         var values = $('#searchForm').getValues();
         for (var item in values) {
             if (item == 'condition' || item == 'keyword' || values[item] == '' || values[item] == null) continue;
             var Operate = $('#searchForm').find('#' + item).attr('Operate');
             if (Operate == null) Operate = '包含';
             var searchinfo = new SearchInfo();
             searchinfo.FiledName = item;
             searchinfo.Value = values[item].toString();
             searchinfo.Operate = Operate;
             searchParams.push(searchinfo);
         }
             var ids = [];

                var rows = $table.bootstrapTable('getSelections');
                if (rows.length == 0) {
                } else {
                    $.each(rows, function (index, value) {
                        ids.push(value['Id']);
                    })
                }
         postExcelFile({ searchInfos: searchParams, idlist: ids },'/Quartz/base_schedulesinfo/ExportExcelBySearchInfo');
    }
  // 导出excel
    function postExcelFile(params, url) {
        //params是post请求需要的参数，url是请求url地址
        var form = document.createElement("form");
        form.style.display = "none";
        form.action = url;
        form.method = "post";
        form.enctype = "application/json";
        form.target = "iframe";
      document.body.appendChild(form);
    // 动态创建input并给value赋值
      for (var key in params) {
        var input = document.createElement("input");
        input.type = "hidden";
        input.name = key;
        input.value = JSON.stringify(params[key]);
        form.appendChild(input);
      }

      form.submit();
      form.remove();
    }
    function getbtn(isview) { if (isview) return []; return ['@TranslateService.GetTranslate("","System_Confirm","确定")', '@TranslateService.GetTranslate("","System_Cancel","取消")'] };
    //打开表单
    function openForm(id, title,isview) {
    if(isview==null) isview=false;
        dialogOpen({
            id: 'form',
            title: title,
            btn: getbtn(isview),
            height:'80%',
            url: '/Quartz/base_schedulesinfo/Form?id={0}'.format(id || '')+'&isview='+isview,
            yes: function (window, body) {
                if(!isview)
                window.submitForm();
                else
                window.clearForm();
            },
            no: function (window, body) {
                window.clearForm();
            }
        });
    }
//复制表单
    function CopyForm(id, title,isview) {
        if(isview==null) isview=false;
        dialogOpen({
            id: 'form',
            title: title,
            btn: getbtn(isview),
            height:'80%',
            url: '/Quartz/base_schedulesinfo/CopyForm?id={0}'.format(id || '')+'&isview='+isview,
            yes: function (window, body) {
                if(!isview)
                window.submitForm();
                else
                window.clearForm();
            },
            no: function (window, body) {
                window.clearForm();
            }
        });
    }
    function print() {
        var searchParams = $('#searchForm').getValues();
        var params = Object.keys(searchParams).map(function (key) {
            return encodeURIComponent(key) + '=' + encodeURIComponent(searchParams[key]);
        }).join('&');
        window.open('/Quartz/base_schedulesinfo/PrintList?' + params);
    }
    function PrintData(id) {
        window.open('/Quartz/base_schedulesinfo/Print?Id' + id);
    }
     //打印表单
    function openPrint(id, title) {
        dialogOpen({
            id: 'form',
            title: title,
            btn: ['@TranslateService.GetTranslate("","System_Confirm","确定")', '@TranslateService.GetTranslate("","System_Cancel","取消")'],
            height: '80%',
            url: '/ERP_D/color/Print?id=0'.format(id || ''),
            yes: function(window, body) {
                window.submitForm();
            },
            no: function (window, body) {
                window.clearForm();
            }
        });
    }

    //删除数据
    function deleteData(id) {
        dialogComfirm('@TranslateService.GetTranslate("","System_SureDelete","确认删除吗？")', function () {
            var ids = [];

            if (typeof (id) == 'string') {//单条数据
                ids.push(id);
            } else {//多条数据
                var rows = $table.bootstrapTable('getSelections');
                if (rows.length == 0) {
                    dialogError('@TranslateService.GetTranslate("","System_NoSelectDeleteData","请选择需要删除的数据！")');
                    return;
                } else {
                    $.each(rows, function (index, value) {
                        ids.push(value['Id']);
                    })
                }
            }

            loading();
            $.postJSON('/Quartz/base_schedulesinfo/DeleteData', { ids: JSON.stringify(ids) }, function (resJson) {
                loading(false);

                if (resJson.Success) {
                    $table.bootstrapTable('refresh');
                    dialogSuccess('@TranslateService.GetTranslate("","System_DeleteSuccess","删除成功！")');
                }
                else {
                    dialogError(resJson.Msg);
                }
            });
        });
    }

     //运行任务
    function RunJob(jobGroup,jobName) {
        dialogComfirm('@TranslateService.GetTranslate("","System_SureRun","确认运行吗？")', function () {
            loading();
            $.postJSON('/Quartz/base_schedulesinfo/RunJob', { jobGroup: jobGroup, jobName: jobName }, function (resJson) {
                loading(false);

                if (resJson.Success) {
                    $table.bootstrapTable('refresh');
                    dialogSuccess('@TranslateService.GetTranslate("", "System_RunSuccess", "运行成功！")');
                }
                else {
                    dialogError(resJson.Msg);
                }
            });
        });
    }

    //暂停任务
    function PauseJob(jobGroup,jobName) {
        dialogComfirm('@TranslateService.GetTranslate("","System_SurePause","确认暂停吗？")', function () {
            loading();
            $.postJSON('/Quartz/base_schedulesinfo/PauseJob', { jobGroup: jobGroup, jobName: jobName }, function (resJson) {
                loading(false);

                if (resJson.Success) {
                    $table.bootstrapTable('refresh');
                    dialogSuccess('@TranslateService.GetTranslate("", "System_PauseSuccess", "暂停成功！")');
                }
                else {
                    dialogError(resJson.Msg);
                }
            });
        });
    }

    //恢复任务
    function ResumeJob(jobGroup, jobName) {
        dialogComfirm('@TranslateService.GetTranslate("","System_SureResume","确认恢复吗？")', function () {
            loading();
            $.postJSON('/Quartz/base_schedulesinfo/ResumeJob', { jobGroup: jobGroup, jobName: jobName }, function (resJson) {
                loading(false);

                if (resJson.Success) {
                    $table.bootstrapTable('refresh');
                    dialogSuccess('@TranslateService.GetTranslate("", "System_ResumeSuccess", "恢复成功！")');
                }
                else {
                    dialogError(resJson.Msg);
                }
            });
        });
    }



    //审核数据
    function approveData(id) {
        dialogComfirm('@TranslateService.GetTranslate("","System_SureApprove","确认审核吗？")', function () {
            var ids = [];

            if (typeof (id) == 'string') {//单条数据
                ids.push(id);
            } else {//多条数据
                var rows = $table.bootstrapTable('getSelections');
                if (rows.length == 0) {
                    dialogError('@TranslateService.GetTranslate("","System_NoSelectApproveData","请选择需要审核的数据！")');
                    return;
                } else {
                    $.each(rows, function (index, value) {
                        ids.push(value['Id']);
                    })
                }
            }

            loading();
            $.postJSON('/Quartz/base_schedulesinfo/ApproveData', { ids: JSON.stringify(ids) }, function (resJson) {
                loading(false);

                if (resJson.Success) {
                    $table.bootstrapTable('refresh');
                    dialogSuccess('@TranslateService.GetTranslate("","System_ApproveSuccess","审核成功！")');
                }
                else {
                    dialogError(resJson.Msg);
                }
            });
        });
    }

    //反审核数据
    function ReverseData(id) {
        dialogComfirm('@TranslateService.GetTranslate("","System_SureReverse","确认反审核吗？")', function () {
            var ids = [];

            if (typeof (id) == 'string') {//单条数据
                ids.push(id);
            } else {//多条数据
                var rows = $table.bootstrapTable('getSelections');
                if (rows.length == 0) {
                    dialogError('@TranslateService.GetTranslate("","System_NoSelectReverseData","请选择需要反审核的数据！")');
                    return;
                } else {
                    $.each(rows, function (index, value) {
                        ids.push(value['Id']);
                    })
                }
            }

            loading();
            $.postJSON('/Quartz/base_schedulesinfo/ReverseData', { ids: JSON.stringify(ids) }, function (resJson) {
                loading(false);

                if (resJson.Success) {
                    $table.bootstrapTable('refresh');
                    dialogSuccess('@TranslateService.GetTranslate("","System_ReverseSuccess","反审核成功！")');
                }
                else {
                    dialogError(resJson.Msg);
                }
            });
        });
    }
</script>
